/**
 * 
 */
package com.edu.lawdoc.generator.field.output;

import java.util.HashMap;
import java.util.Map;

/**
 * @author huxiao
 *
 */
public class Column {
	
	private static Map<String, String> typeDict = new HashMap<String, String>();
	static {
		/*必须实例化内部静态类，才会执行内部的静态代码块*/
		
		new DEMO_OPTIONS();
	
	}

	public static String pure(String constKey) {
		if(constKey == null || "".equals(constKey.trim())) {
			throw new IllegalArgumentException("constKey is null");
		}
		
		int index = constKey.indexOf(".");
		if(index == -1) {
			return constKey;
		}
		return constKey.substring(index + 1);
	}
	
	public static String getType(String constKey) {
		return typeDict.get(constKey);
	}
	
	public final static String NAMESPACE_COMMON = "_common.";
	public final static String ID = "id";
	static {
		typeDict.put(ID, "java.lang.Long");
		typeDict.put(NAMESPACE_COMMON + ID, "java.lang.Long");
	}
	
	public final static String GMT_CREATED = "gmt_created";
	static {
		typeDict.put(GMT_CREATED, "java.util.Date");
		typeDict.put(NAMESPACE_COMMON + GMT_CREATED, "java.util.Date");
	}
	
	public final static String CREATOR = "creator";
	static {
		typeDict.put(CREATOR, "java.lang.String");
		typeDict.put(NAMESPACE_COMMON + CREATOR, "java.lang.String");
	}
	
	public final static String GMT_MODIFIED = "gmt_modified";
	static {
		typeDict.put(GMT_MODIFIED, "java.util.Date");
		typeDict.put(NAMESPACE_COMMON + GMT_MODIFIED, "java.util.Date");
	}
	
	public final static String MODIFIER = "modifier";
	static {
		typeDict.put(MODIFIER, "java.lang.String");
		typeDict.put(NAMESPACE_COMMON + MODIFIER, "java.lang.String");
	}
	
	public final static String IS_DELETED = "is_deleted";
	static {
		typeDict.put(IS_DELETED, "java.lang.String");
		typeDict.put(NAMESPACE_COMMON + IS_DELETED, "java.lang.String");
	}
	
	public final static String VERSION = "version";
	static {
		typeDict.put(VERSION, "java.lang.Integer");
		typeDict.put(NAMESPACE_COMMON + VERSION, "java.lang.Integer");
	}


	public static class DEMO_OPTIONS {
	    public final static String NAMESPACE = "demo_options";

		private final static String prefix = NAMESPACE + ".";
			
		
		public final static String DOMAIN = "domain";
		public final static String PREFIX__DOMAIN = prefix + DOMAIN;
				
		static {
			typeDict.put(PREFIX__DOMAIN, "java.lang.String");
		}
		
		public final static String OPTION_NAME = "option_name";
		public final static String PREFIX__OPTION_NAME = prefix + OPTION_NAME;
				
		static {
			typeDict.put(PREFIX__OPTION_NAME, "java.lang.String");
		}
		
		public final static String OPTION_VALUE = "option_value";
		public final static String PREFIX__OPTION_VALUE = prefix + OPTION_VALUE;
				
		static {
			typeDict.put(PREFIX__OPTION_VALUE, "java.lang.String");
		}
		
		public final static String COMMENT = "comment";
		public final static String PREFIX__COMMENT = prefix + COMMENT;
				
		static {
			typeDict.put(PREFIX__COMMENT, "java.lang.String");
		}
	}

}
